﻿#include "FusionSpyWlsAlarmDlg.h"

FusionSpyWlsAlarmDlg::FusionSpyWlsAlarmDlg( wxWindow* parent )
:
WlsAlarmDlg( parent )
{

}

void FusionSpyWlsAlarmDlg::OnInitDialog( wxInitDialogEvent& event )
{
	// TODO: Implement OnInitDialog
	m_chkSvrDied->SetValue( !m_wlsalarm.SvrDied.empty() );
	m_txtSvrDiedList->WriteText( m_wlsalarm.SvrDied );

	m_chkFreeHeap->SetValue( !m_wlsalarm.FreeHeap.empty() );
	m_txtFreeHeapLow->WriteText( m_wlsalarm.FreeHeap );

	m_chkIdleThread->SetValue( !m_wlsalarm.IdleThread.empty() );
	m_txtThreadLow->WriteText( m_wlsalarm.IdleThread );

	m_chkIdleJDBC->SetValue( !m_wlsalarm.IdleJDBC.empty() );
	m_txtJDBCLow->WriteText( m_wlsalarm.IdleJDBC );


	m_chkPlayMusic->SetValue( !m_wlsalarm.PlaySound.empty() );
	m_chkEmail->SetValue( !m_wlsalarm.Email.empty() );
	m_chkSMS->SetValue( !m_wlsalarm.SMS.empty() );
	m_chkThreadDump->SetValue( !m_wlsalarm.ThreadDump.empty() );

}

void FusionSpyWlsAlarmDlg::OnAlarmDlgOK( wxCommandEvent& event )
{
	//wlsalarmset
	if( m_chkSvrDied->IsChecked() )	m_wlsalarm.SvrDied = m_txtSvrDiedList->GetValue();
	else m_wlsalarm.SvrDied.Empty();

	if( m_chkFreeHeap->IsChecked() )	m_wlsalarm.FreeHeap = m_txtFreeHeapLow->GetValue();
	else m_wlsalarm.FreeHeap.Empty();

	if( m_chkIdleThread->IsChecked() )	m_wlsalarm.IdleThread = m_txtThreadLow->GetValue();
	else m_wlsalarm.IdleThread.Empty();

	if( m_chkIdleJDBC->IsChecked() )	m_wlsalarm.IdleJDBC = m_txtJDBCLow->GetValue();
	else m_wlsalarm.IdleJDBC.Empty();

	if( m_chkPlayMusic->IsChecked() )	m_wlsalarm.PlaySound = wxT("TRUE");
	else m_wlsalarm.PlaySound.Empty();

	if( m_chkEmail->IsChecked() )	m_wlsalarm.Email = wxT("TRUE");
	else m_wlsalarm.Email.Empty();

	if( m_chkSMS->IsChecked() )	m_wlsalarm.SMS = wxT("TRUE");
	else m_wlsalarm.SMS.Empty();

	if( m_chkThreadDump->IsChecked() )	m_wlsalarm.ThreadDump = wxT("TRUE");
	else m_wlsalarm.ThreadDump.Empty();


	SetReturnCode( IDOK );
	Destroy();
}

void FusionSpyWlsAlarmDlg::SetWlsAlarm( WlsAlarm tuxalarm )
{
	m_wlsalarm = tuxalarm;
}

WlsAlarm FusionSpyWlsAlarmDlg::GetWlsAlarm( )
{
	return m_wlsalarm;
}
